#pragma once
#pragma once
#include "tinyrpc/base/Fd.h"
#include <memory>
#include "socketchannel.h"
#include "../inetaddress.h"
#include "AbstractChannel.h"
#include "../eventloop.h"
namespace TinyRPC{

// class ServerSocketChannelImpl : public AbstractChannel{
// public:
//     static ServerSocketChannelImpl CreateAndBind(INetAddress & address);
//     SocketChannel accept();
//     int listen();

//     ~ServerSocketChannelImpl(){
//         deleteEvent(EventLoop::CurrentEventLoop());
//     }
// private:
//     ServerSocketChannelImpl(int fd, INetAddress & address);
// private:
//     INetAddress m_localAddress;
// };


class ServerSocketChannel : public AbstractChannel{
public:
    static ServerSocketChannel CreateAndBind(INetAddress & address);
    SocketChannelPtr accept();
    int listen();
private:
    ServerSocketChannel(int fd, INetAddress & address);
private:
    INetAddress m_localAddress;
};
}
